package cn.tedu.service.impl;

import cn.tedu.dao.UserDao;
import cn.tedu.dao.impl.UserDaoImpl;
import cn.tedu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * @Service 标记当前类是业务层,交给Spring容器
 */
@Service
public class UserServiceImpl implements UserService {
    /**
     * @Autowired 注解,会自动根据标记的变量名,从Spring容器中获取对应的实例
     * 也就是我们标记的变量是'userDao',底层会自动从Spring容器中,获取对应的实例,
     * 注入到标记的'userDao'变量中
     */
    @Autowired
    private UserDao userDao;

    @Override
    public void save() {
        //userDao = new UserDaoImpl();
        userDao.save();
    }
}
